function isNumber(v) {  
    return v === +v  
} 

/**
 * 
 * 
 * @class Attribute
 */
class Attribute {
	/**
	 * Creates an instance of Attribute.
	 * @param {Object} attr
	 * 	
	 * 	@param {Number} attr.attack - 攻击力
	 * 	@param {Number} attr.defensePiercingDamage - 无视防御攻击
	 * 	@param {Number} attr.attackEnhance -  攻击力提升
	 * 	@param {Number} attr.intellect - 智力
	 * 	@param {Number} attr.intellectEnhance - 智力提升
	 * 	@param {Number} attr.critical - 暴击率
	 * 	@param {Number} attr.elementIntensify - 属性强化
	 * 	@param {Number} attr.criticalDamage - 暴击伤害
	 * 	@param {Number} attr.additionalCriticalDamage - 暴击伤害追加
	 * 	@param {Number} attr.bonusDamage - 附加伤害
	 * 	@param {Number} attr.attackDamage - 伤害增加
	 * 	@param {Number} attr.additionalAttackDamage - 伤害增加追加 
	 * 	@param {Number} attr.allAttackEnhance - 所有攻击力增加
	 * 	@param {Number} attr.skillAtk - 所有技能攻击力
	 * 
	 * @memberof Attribute
	 */
	constructor(attr) {
		this.attack = attr.attack || 0;
		this.defensePiercingDamage = attr.defensePiercingDamage || 0;
		this.attackEnhance = attr.attackEnhance || 0;
		this.intellect = attr.intellect || 0;
		this.intellectEnhance = attr.intellectEnhance || 0;
		this.critical = attr.critical || 0;
		this.elementIntensify = attr.elementIntensify || 0;
		this.criticalDamage = attr.criticalDamage || 0;
		this.additionalCriticalDamage = attr.additionalCriticalDamage || 0;
		this.bonusDamage = attr.bonusDamage || 0;
		this.attackDamage = attr.attackDamage || 0;
		this.additionalBonusDamage = attr.additionalAttackDamage || 0;
		this.allAtkEnhance = attr.allAttackEnhance || 0;
		this.skillAtk = attr.skillAtk || 0;
	}
}

/**
 * 
 * 
 * @export
 * @class Monster
 */
export class Monster {
	/**
	 * Creates an instance of Monster.
	 * @param {Number} level - 等级
	 * @param {Number} defense - 防御力
	 * @param {Number} fire - 火属性抗性
	 * @param {Number} water - 冰属性抗性
	 * @param {Number} light - 光属性抗性
	 * @param {Number} shadow - 暗属性抗性
	 * @param {number} [neglect=0.8] 
	 * 
	 * @memberof Monster
	 */
	constructor(level, defense, fire, water, light, shadow, neglect = 0.8) {
		this.level = level;
		this.defense = defense;
		this.ignoreRatio = neglect;
		this.resist = new Resist(fire, water, light, shadow);
	}
}

/**
 * 
 * 
 * @export
 * @class Unit
 * @extends {Attribute}
 */
export class Unit extends Attribute {
	/**
	 * Creates an instance of Unit.
	 * @param {Object} param 
	 * @param {Number} param.level - 在 {Attribute} 的基础上新增了[等级]这个数据
	 * 
	 * @memberof Unit
	 */
	constructor(param) {
		super(param)
		this.level = param.level
	}
}

/**
 * 
 * 
 * @export
 * @class Item
 * @extends {Attribute}
 */
export class Item extends Attribute {
	/**
	 * Creates an instance of Item.
	 * @param {Object} param 
	 * @param {Number} param.name - 在 {Attribute} 的基础上新增了[物品名称]这个数据
	 *
	 * @memberof Item
	 */
	constructor(param) {
		super(param)
		this.name = param.name
	}
}